home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / daemons / dns / bind-4.9 / bind-4 / usr / man / man3 / getnetent.3 < prev    next >
Encoding:
Text File  |  1995-08-04  |  4.1 KB  |  133 lines

  1.  
  2.  
  3.  
  4. getnetent(3)                                         getnetent(3)
  5.  
  6.  
  7. NNAAMMEE
  8.        getnetent,  getnetbyaddr,  getnetbyname, setnetent, endne-
  9.        tent - get networks entry
  10.  
  11. SSYYNNTTAAXX
  12.        ##iinncclluuddee <<nneettddbb..hh>>
  13.  
  14.        ssttrruucctt nneetteenntt **ggeettnneetteenntt(())
  15.  
  16.        ssttrruucctt nneetteenntt **ggeettnneettbbyynnaammee((_n_a_m_e))
  17.        cchhaarr **_n_a_m_e;;
  18.  
  19.        ssttrruucctt nneetteenntt **ggeettnneettbbyyaaddddrr((_n_e_t,, _t_y_p_e))
  20.        lloonngg _n_e_t;; iinntt _t_y_p_e;;
  21.  
  22.        vvooiidd sseettnneetteenntt((_s_t_a_y_o_p_e_n))
  23.        iinntt _s_t_a_y_o_p_e_n;;
  24.  
  25.        vvooiidd eennddnneetteenntt(())
  26.  
  27. DDEESSCCRRIIPPTTIIOONN
  28.        The _g_e_t_n_e_t_e_n_t, _g_e_t_n_e_t_b_y_n_a_m_e, and _g_e_t_n_e_t_b_y_a_d_d_r  subroutines
  29.        each  return  a  pointer  to  an object with the following
  30.        structure containing the broken-out fields of  a  line  in
  31.        the _n_e_t_w_o_r_k_s database.
  32.  
  33.               struct    netent {
  34.                    char *n_name;  /* official name of net */
  35.                    char **n_aliases;   /* alias list */
  36.                    int  n_addrtype;    /* net number type */
  37.                    long n_net;         /* net number */
  38.               };
  39.  
  40.        The members of this structure are:
  41.  
  42.        n_name      The official name of the network.
  43.  
  44.        n_aliases   A  zero terminated list of alternate names for
  45.                    the network.
  46.  
  47.        n_addrtype  The  type  of  the  network  number  returned:
  48.                    AF_INET.
  49.  
  50.        n_net       The   network  number.   Network  numbers  are
  51.                    returned in machine byte order.
  52.  
  53.        If the _s_t_a_y_o_p_e_n flag on a _s_e_t_n_e_t_e_n_t  subroutine  is  NULL,
  54.        the  _n_e_t_w_o_r_k_s database is opened.  Otherwise the _s_e_t_n_e_t_e_n_t
  55.        has the effect of rewinding the  _n_e_t_w_o_r_k_s  database.   The
  56.        _e_n_d_n_e_t_e_n_t  may  be  called  to close the _n_e_t_w_o_r_k_s database
  57.        when processing is complete.
  58.  
  59.        The _g_e_t_n_e_t_e_n_t subroutine simply reads the next line  while
  60.        _g_e_t_n_e_t_b_y_n_a_m_e and _g_e_t_n_e_t_b_y_a_d_d_r search until a matching _n_a_m_e
  61.  
  62.  
  63.  
  64.                                                                 1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. getnetent(3)                                         getnetent(3)
  71.  
  72.  
  73.        or _n_e_t number is found (or until EOF is encountered).  The
  74.        _t_y_p_e  must  be  AF_INET.  The _g_e_t_n_e_t_e_n_t subroutine keeps a
  75.        pointer in the database, allowing successive calls  to  be
  76.        used to search the entire file.
  77.  
  78.        A call to _s_e_t_n_e_t_e_n_t must be made before a _w_h_i_l_e loop using
  79.        _g_e_t_n_e_t_e_n_t in order to perform initialization and an _e_n_d_n_e_-
  80.        _t_e_n_t  must  be used after the loop.  Both _g_e_t_n_e_t_b_y_n_a_m_e and
  81.        _g_e_t_n_e_t_b_y_a_d_d_r make calls to _s_e_t_n_e_t_e_n_t and _e_n_d_n_e_t_e_n_t _.
  82.  
  83. FFIILLEESS
  84.        _/_e_t_c_/_n_e_t_w_o_r_k_s
  85.  
  86. DDIIAAGGNNOOSSTTIICCSS
  87.        Null pointer (0) returned on EOF or error.
  88.  
  89. SSEEEE AALLSSOO
  90.        networks(5)
  91.        RFC 1101
  92.  
  93. HHIISSTTOORRYY
  94.        The getnetent(),  getnetbyaddr(),  getnetbyname(),  setne-
  95.        tent(), and endnetent() functions appeared in 4.2BSD.
  96.  
  97. BBUUGGSS
  98.        The  data  space  used  by  these  functions is static; if
  99.        future use requires the data, it should be  copied  before
  100.        any  subsequent  calls  to  these  functions overwrite it.
  101.        Only Internet network numbers  are  currently  understood.
  102.        Expecting  network  numbers to fit in no more than 32 bits
  103.        is probably naive.
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.                                                                 2
  131.  
  132.  
  133.